package IteratorAndComposite.IteratorInterfacesImpl;

import IteratorAndComposite.entry.MenuItem;

import java.util.Iterator;
import java.util.List;

/**
 * @Author: pengzx
 * @Description:
 * @Date: 17:04 2017/9/19
 * @Modified by: 1.0
 */
public class PancakeHouseIterator implements Iterator {
    List item;
    int position = 0;
    @Override
    public boolean hasNext()
    {
        if (item.size()<=position){
            return false;
        }else{
            return true;
        }
    }

    @Override
    public Object next()
    {
        MenuItem menuItem = (MenuItem) item.get(position);
        position++;
        return menuItem;
    }

    public PancakeHouseIterator(List item)
    {
        this.item = item;
    }
}
